using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;


public partial class ConnectionPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string connectionString =
        WebConfigurationManager.ConnectionStrings[
        "RCVDB2005"].ConnectionString;        
        SqlConnection sqlConnection = 
        new SqlConnection();
        Literal1.Text = "Object Initiated: "+ 
        DateTime.Now.ToLongTimeString();
        Literal1.Text += "<br>";
        sqlConnection.ConnectionString = 
        connectionString;
        try
        {
            sqlConnection.Open();
            Literal1.Text += "Opened database: "+
            DateTime.Now.ToLongTimeString();
            Literal1.Text += "<br>";
            Literal1.Text += "Server Version: " +
            sqlConnection.ServerVersion;
            Literal1.Text += "<br>";
            
            sqlConnection.Close();
            Literal1.Text += "Closed database: "+
            DateTime.Now.ToLongTimeString();
            Literal1.Text += "<br>";      
        }
        catch(Exception ex)
        {
            Literal1.Text += "Failed:" + ex.Message;
        }
        sqlConnection.Dispose();
        Literal1.Text += "Disposed database: "+
        DateTime.Now.ToLongTimeString();
        Literal1.Text += "<br>"; 
    }
}
